var roleId = sessionStorage.getItem("roleId");
roleId = roleId.split(",");
var heighta = 0;
if(roleId.sort().toString() == [1].sort().toString()) {
	heighta = 414;
} else if(roleId.sort().toString() == [2, 3, 4, 5].sort().toString()) {
	heighta = 414;
} else if(roleId.sort().toString() == [2, 3, 5].sort().toString()) {
	$(".apply-second").remove();
	heighta = 414 - 71;
} else if(roleId.sort().toString() == [2, 3, 4].sort().toString()) {
	$(".apply-third").remove();
	heighta = 414 - 71;
} else if(roleId.sort().toString() == [2, 4, 5].sort().toString()) {
	$(".apply-frist").remove();
	heighta = 414 - 71;
} else if(roleId.sort().toString() == [3, 4, 5].sort().toString()) {
	$(".apply_one").remove();
	heighta = 414 - 71;
} else if(roleId.sort().toString() == [2, 3].sort().toString()) {
	$(".apply-second,.apply-third").remove();
	heighta = 414 - 142;
} else if(roleId.sort().toString() == [2, 4].sort().toString()) {
	$(".apply-third,.apply-frist").remove();
	heighta = 414 - 142;
} else if(roleId.sort().toString() == [2, 5].sort().toString()) {
	$(".apply-second,.apply-frist").remove();
	heighta = 414 - 142;
} else if(roleId.sort().toString() == [3, 4].sort().toString()) {
	$(".apply_one,.apply-third").remove();
	heighta = 414 - 142;
} else if(roleId.sort().toString() == [5, 4].sort().toString()) {
	$(".apply-frist,.apply_one").remove();
	heighta = 414 - 142;
} else if(roleId.sort().toString() == [3, 5].sort().toString()) {
	$(".apply-second,.apply_one").remove();
	heighta = 414 - 142;
} else if(roleId.sort().toString() == [2].sort().toString()) {
	$(".apply-second,.apply-third,.apply-frist").remove();
	heighta = 414 - 213;
} else if(roleId.sort().toString() == [3].sort().toString()) {
	$(".apply-second,.apply-third,.apply_one").remove();
	heighta = 414 - 213;
} else if(roleId.sort().toString() == [4].sort().toString()) {
	$(".apply-frist,.apply-third,.apply_one").remove();
	heighta = 414 - 213;
} else if(roleId.sort().toString() == [5].sort().toString()) {
	$(".apply-second,.apply-frist,.apply_one").remove();
	heighta = 414 - 213;
}

function autodivheight() {
	//函数：获取尺寸
	//获取浏览器窗口高度
	var winHeight = 0;
	if(window.innerHeight) {
		winHeight = window.innerHeight;
	} else if((document.body) && (document.body.clientHeight)) {
		winHeight = document.body.clientHeight;
	}
	//通过深入Document内部对body进行检测，获取浏览器窗口高度
	if(document.documentElement && document.documentElement.clientHeight) {
		winHeight = document.documentElement.clientHeight;
	}
	//DIV高度为浏览器窗口的高度
	c = winHeight - 330;

	a = winHeight - heighta;
	//alert(a)
	if(a < 0) {
		a = 0;
		$(".winHeight").css("height", a);
	} else {
		b = winHeight - 120;
		$(".winHeight").css("height", a);
		$(".content_right_content").css("height", b);
		$(".pageTool").css("height", c);
	}
	//				document.getElementById("test").style.height = winHeight / 2 + "px";
}
autodivheight();
window.onresize = autodivheight;

/*自制点击*/
function bfirst() {
	if($(".AimgAdd").css("display") == "block" || $(".AimgAdd").css("display") == "inline") {
		$(".BimgAdd,.b_one,.CimgAdd,.AimgReduce,.apply_second,.DimgAdd,.cimgAdd,.dimgAdd").show();
		$(".BimgReduce,dimgReduce,.device_fourth,.journal_second,.journal_thrid,.deviceGroup,.base_third,.base_one, .base_two,.base_three,.base_second,.CimgReduce,.AimgAdd,.DimgReduce,.cimgReduce,.device_second,.device_third,.device_two,.device_two,.b_two,.b_three,.b_four,.journal_frist").hide();
		$("a,div").removeClass("apply_activation");
	} else if($(".AimgAdd").css("display") == "none") {
		$(".AimgAdd,.aimgAdd").show();
		$("a,div").removeClass("apply_activation");
		$(".AimgReduce,.apply_second,.apply_third,.aimgReduce,.b_one").hide();
	}
}

function bsecond() {
	if($(".BimgAdd").css("display") == 'block' || $(".BimgAdd").css("display") == "inline") {
		$(".aimgAdd,.b_two,.bimgAdd,.AimgAdd,dimgAdd,.BimgReduce,.CimgAdd,.DimgAdd,.device_second,.cimgAdd,.device_fourth,.deviceGroup").show();
		$(".apply_second,.journal_second,.base_third,dimgReduce,.journal_thrid,.base_one, .base_two,.base_three,.base_second,.apply_third,.aimgReduce,.bimgReduce,.AimgReduce,.cimgReduce,.BimgAdd,.CimgReduce,.DimgReduce,.b_one,.b_three,.b_four,.journal_frist").hide();
		$("a,div").removeClass("apply_activation");

	} else if($(".BimgAdd").css("display") == 'none') {
		$(".BimgAdd,.bimgAdd").show();
		$(".BimgReduce,.b_two,.bimgReduce,.device_second,.device_third,.device_two,.device_fourth,.deviceGroup").hide();
		$("a,div").removeClass("apply_activation");

	}
}

function bthird() {
	if($(".CimgAdd").css("display") == 'block' || $(".CimgAdd").css("display") == "inline") {
		$("a,div").removeClass("apply_activation");
		$(".cimgAdd,.BimgAdd,dimgAdd,.aimgAdd,.bimgAdd,.AimgAdd,.DimgAdd,.CimgReduce,.base_one, .base_two,.base_three,.base_second,.cimgAdd,.b_three").show();
		$(".cimgReduce,.device_fourth,.AimgReduce,.dimgReduce,.base_third,.journal_thrid,.journal_second,.deviceGroup,.apply_second,.device_third,.device_two,.apply_third,.BimgReduce,.aimgReduce,.bimgReduce,.CimgAdd,.DimgReduce,.journal_frist,.device_second,.b_one,.b_two,.b_four").hide();

	} else if($(".CimgAdd").css("display") == 'none') {
		$(".CimgReduce,.base_second,.base_third,.b_three").hide();
		$(".CimgAdd").show();
		$("a,div").removeClass("apply_activation");

	}
}

function bfourth() {
	if($(".DimgAdd").css("display") == 'block' || $(".DimgAdd").css("display") == "inline") {
		$(".cimgAdd,.dimgAdd,.journal_second,.journal_thrid,.BimgAdd,.aimgAdd,.bimgAdd,.AimgAdd,.DimgReduce,.CimgAdd,.b_four,.journal_frist").show();
		$(".cimgReduce,.device_fourth,.dimgReduce,.apply_second,.base_third,.base_one, .base_two,.base_three,.base_second,.deviceGroup,.device_third,.device_two,.apply_third,.BimgReduce,.aimgReduce,.bimgReduce,.AimgReduce,.DimgAdd,.CimgReduce,.device_second,.b_one,.b_two,.b_three").hide();
		$("a,div").removeClass("apply_activation");

	} else if($(".DimgAdd").css("display") == 'none') {
		$(".DimgReduce,.journal_second,.journal_thrid,.b_four,.journal_frist").hide();
		$(".DimgAdd").show();
		$("a,div").removeClass("apply_activation");

	}
}

/*二级自制点击*/
function applyActivation() {
	if($(".aimgAdd").css("display") == 'block' || $(".aimgAdd").css("display") == "inline") {
		$(".aimgReduce").show();
		$(".aimgAdd").hide();
		$("a,div").removeClass("apply_activation");
		$(".apply_second").addClass("apply_activation");
		$(".apply_third").show();
	} else if($(".aimgAdd").css("display") == 'none') {
		$(".aimgAdd").show();
		$(".aimgReduce").hide();
		$("a,div").removeClass("apply_activation");
		$(".apply_third").hide();
	}
}

function deviceActivation() {
	if($(".bimgAdd").css("display") == 'block' || $(".bimgAdd").css("display") == "inline") {
		$(".bimgReduce").show();
		$(".bimgAdd").hide();
		$("a,div").removeClass("apply_activation");
		$(".device_second").addClass("apply_activation");
		$(".device_third,.device_two,").show();
	} else if($(".bimgAdd").css("display") == 'none') {
		$(".bimgAdd").show();
		$(".bimgReduce").hide();
		$("a,div").removeClass("apply_activation");
		$(".device_third,.device_two,").hide();
	}
}

function baseActivation() {
	if($(".cimgAdd").css("display") == 'block' || $(".cimgAdd").css("display") == "inline") {
		$(".cimgReduce").show();
		$(".cimgAdd").hide();
		$("a,div").removeClass("apply_activation");
		$(".base_second").addClass("apply_activation");
		$(".base_third").show();
	} else if($(".cimgAdd").css("display") == 'none') {
		$(".cimgAdd").show();
		$(".cimgReduce").hide();
		$("a,div").removeClass("apply_activation");
		$(".base_third").hide();
	}
}

//function journalActivation() {
//	if($(".dimgAdd").css("display") == 'block' || $(".dimgAdd").css("display") == "inline") {
//		$(".dimgReduce").show();
//		$(".dimgAdd").hide();
//		$("a,div").removeClass("apply_activation");
//		$(".journal_second").addClass("apply_activation");
//		$(".journal_third").show();
//	} else if($(".dimgAdd").css("display") == 'none') {
//		$(".dimgAdd").show();
//		$(".dimgReduce").hide();
//		$("a,div").removeClass("apply_activation");
//		$(".journal_third").hide();
//	}
//}
/*退出*/
function dropout() {
	$(".dropOut").show();
	$(".dropOut-a").show();
}

function cancel() {
	$(".dropOut").hide();
	$(".dropOut-a").hide();
}

function dropOut() {
	$.Cookie('session', null);
	$.Cookie('userId', null);
	$.Cookie('companyId', null);
	$.Cookie('userName', null);
	$.Cookie('orgName', null);
	window.location.href = 'index.jsp';
}
$(".content_right_header_frist_a").text($.Cookie("orgName"))
$(".content_right_header_frist_b").text($.Cookie("userName"))

$(".apply_third").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".apply_third").addClass("apply_activation");
})
$(".device_third").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".device_third").addClass("apply_activation");
})
$(".device_two").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".device_two").addClass("apply_activation");
})
$(".deviceGroup").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".deviceGroup").addClass("apply_activation");
})
$(".base_second").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".base_second").addClass("apply_activation");
})
$(".base_one").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".base_one").addClass("apply_activation");
})
$(".base_two").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".base_two").addClass("apply_activation");
})
$(".base_three").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".base_three").addClass("apply_activation");
})
$(".journal_second").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".journal_second").addClass("apply_activation");
})
$(".journal_thrid").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".journal_thrid").addClass("apply_activation");
})

$(".journal_frist").click(function() {
	$("a,div").removeClass("apply_activation");
	$(".journal_frist").addClass("apply_activation");
})

//检查用户是否被挤掉
var checkTime;

function UserOnline() {

	$.ajax({
		url: 'paramTypeList',
		type: 'POST',
		data: {
			session: $.Cookie("session"),
			userId: $.Cookie("userId"),
			companyId: $.Cookie("companyId"),
			index: 0,
			page: 20
		},
		dataType: 'json',
		success: function(data) {
			if(data.errorCode == 0) {
			} else if(data.errorCode == -6) {
				alert("登录超时！")
				top.location.href = 'index.jsp';
			}
		},
		error: function(err) {
			alert("连接服务器失败！请重新提交！")
			top.location.href = 'index.jsp';
		}
	});
}

function checkLogin() {
	checkTime = setInterval("UserOnline()", 10000);
}
//checkLogin();






      
       
